<html><head><title>SendMail</title></head>
<body bgcolor="#EFF1F0" link="#3A3966" vlink="#000000" alink="#000000">
<font face="Verdana, sans-serif" size="2"><p align="center"><b><font size="4">SendMail()</font></b></p>
<p><b>Syntax</b></p><blockquote>
Result = <font color="#3A3966"><b>SendMail</b></font>(#Mail, Smtp$ [, Port [, Flags [, User$, Password$]]])</blockquote>

</blockquote>
<b>Description</b><br><blockquote>

Send the specified mail. 

</blockquote><p><b>Parameters</b></p><blockquote>
<style type="text/css">
table.parameters { border-spacing: 0px; border-style: none; border-collapse: collapse; }
table.parameters td { border-width: 1px; padding: 6px; border-style: solid; border-color: gray; vertical-align: top; font-family:Arial; font-size:10pt; }
</style>
<table width="90%" class="parameters">
<tr><td width="10%"><i>#Mail</i></td>
<td width="90%"> 
The mail to send. 

</td></tr>
<tr><td><i>Smtp$</i></td>
<td> 
The address of the mail server to use for sending the mail. 


</td></tr>
<tr><td><i>Port (optional)</i></td>
<td> 
The port of the mail server. The default is port 25. 

</td></tr>
<tr><td><i>Flags (optional)</i></td>
<td> 
It can be a combination of the following values: 
<pre><font face="Courier New, Courier, mono"size="2">  <font color="#924B72">#PB_Mail_Asynchronous</font>: sends the mail in the background. <a href="mailprogress.html">MailProgress()</a> can be used to follow the progress.
  <font color="#924B72">#PB_Mail_UseSSL</font>      : uses TLS/SSL to send the mail (the server needs to support this protocol).
</font></pre>

</td></tr>
<tr><td><i>User$, Password$ (optional)</i></td>
<td> 
The user and password used for SMTP authentication, if the server requires it. 

</td></tr>
</table>
</blockquote><p><b>Return value</b></p><blockquote>

Returns nonzero if the mail was sent correctly and zero otherwise. 

</blockquote><p><b>Example:</b> Simple SMTP</p><blockquote>

<pre><font face="Courier New, Courier, mono"size="2"><font color="#3A3966">  InitNetwork</font>()

  <font color="#3A3966">; Note: change the address and smtp to have a working example</font>
  <font color="#3A3966">;</font>
  <b><font color="#3A3966">If</font></b> <font color="#3A3966">CreateMail</font>(0, &quot;test@youraddress.com&quot;, &quot;Hello&quot;)
<font color="#3A3966">    AddMailRecipient</font>(0, &quot;youraddress@youraddress.com&quot;, <font color="#924B72">#PB_Mail_To</font>)

    <b><font color="#3A3966">Debug</font></b> <font color="#3A3966">SendMail</font>(0, &quot;smtp.yourfavoritesmtp.com&quot;)
  <b><font color="#3A3966">EndIf</font></b>
</font></pre>

</blockquote><p><b>Example:</b> Using GMail (TLS)</p><blockquote>

<pre><font face="Courier New, Courier, mono"size="2"><font color="#3A3966">  InitNetwork</font>()

  <font color="#3A3966">; Be sure to use the right login and right password</font>
  <font color="#3A3966">;</font>
  Login$ = &quot;yourlogin&quot;
  <b><font color="#3A3966">If</font></b> <font color="#3A3966">CreateMail</font>(0, Login$ + &quot;@gmail.com&quot;, &quot;Hello&quot;)
<font color="#3A3966">    AddMailRecipient</font>(0, &quot;youraddress@youraddress.com&quot;, <font color="#924B72">#PB_Mail_To</font>)

    <b><font color="#3A3966">Debug</font></b> <font color="#3A3966">SendMail</font>(0, &quot;smtp.gmail.com&quot;, 587, <font color="#924B72">#PB_Mail_UseSSL</font>, Login$, &quot;password&quot;)
  <b><font color="#3A3966">EndIf</font></b>
</font></pre>

</blockquote><p><b>See Also</b></p><blockquote>

<a href="createmail.html">CreateMail()</a>, <a href="mailprogress.html">MailProgress()</a> 

</Blockquote><p><b>Supported OS </b><Blockquote>All</Blockquote></p><center><- <a href=removemailrecipient.html>RemoveMailRecipient()</a> - <a href="index.html">Mail Index</a> - <a href="setmailattribute.html">SetMailAttribute()</a> -><br><br>

</body></html>